package org;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Documents {
	
	private String tinyDoc, smallDoc, largeDoc;
	final String files[] = {"text//textfile_tiny.txt","text//textfile_small.txt","text//textfile_large.txt"};
	
	public Documents(){
		StringBuilder attributeValue = new StringBuilder();
		Scanner s = null;
		for(int i=0;i<files.length;i++)
		{
	        try
	        {
	        	File file = new File(files[i]);
	        	try
	        	{
	        		s = new Scanner(file);
	    		} catch (FileNotFoundException e)
	    		{ e.printStackTrace(); }
	
	        	while (s.hasNextLine())
	            	attributeValue.append(s.nextLine() + "\n");
	        }
	        finally
	        {
	        	if (s != null)
	        		s.close();
	    	}
	        if(i==0){
	            tinyDoc = attributeValue.toString();
	            }
	        else if(i==1){
	        	smallDoc = attributeValue.toString();	
	            }
	        else if(i==2){
	        	largeDoc = attributeValue.toString();
	            }
	        attributeValue.setLength(0);        
		}
	}

	public String getTiny(){
		return tinyDoc;
	}
	
	public String getSmall(){
		return smallDoc;
	}
	
	public String getLarge(){
		return largeDoc;
	}
}
